package org.example.demo.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @ClassName: Fsk App
 * @Copyright: com.fsk
 * @Version: 1.0.0
 * @Author: chenming2
 * @UpdateTime: 2/27/2022
 * @Describe: XXXXXXX.
 */
@Component
@Aspect
@Order(1)
public class PersonDaoProxy {
    @Before("execution(* org.example.demo.dao.UserDao.add(..))")
    public void before() {
        System.out.println("person .... before");
    }

    @Around("execution(* org.example.demo.dao.UserDao.add(..))")
    public void around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("person .... around .... before");
        joinPoint.proceed();
        System.out.println("person .... around .... after");
    }
}
